package chapter_03.list_stack_queue;

import org.junit.jupiter.api.Test;

import java.util.Iterator;
import java.util.LinkedList;

public class Run {
    @Test
    public void testMyLinkedList() {
        MyLinkedList<Integer> linkedList = new MyLinkedList<>();
        linkedList.add(0, 5);
        linkedList.add(2);

        linkedList.reverse();
        for (Integer integer : linkedList) {
            System.out.println(integer);
        }
    }

    @Test
    public void testMySingleLinkedList() {
        MySingleLinkedList<Integer> mySingleLinkedList = new MySingleLinkedList<>();
        mySingleLinkedList.add(1);
        mySingleLinkedList.add(2);
        mySingleLinkedList.add(3);
        mySingleLinkedList.add(2, 5);
        mySingleLinkedList.update(1,100);

        mySingleLinkedList.remove(0);

        Iterator<Integer> iterator = mySingleLinkedList.iterator();
        while(iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }

}
